home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Aug 90 / MacApp.Tech$ 8⁄3⁄90 / 1674-TextEdit Problem-Aug90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  4.2 KB  |  81 lines  |  [TEXT/GEOL]

  1. Item    2847445                         1-Aug-90        20:01PDT
  2.  
  3. From:   N0917                           E I DuPont, Simon Edkins,ASC,NAT
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.  
  7. Sub:    TextEdit Problem
  8.  
  9.     I have devised a feature of the interface for my current MacApp application
  10. which, if it can be implemented, will be very slick and much better than what
  11. is in place now. The problem is, I am still somewhat of a MacApp novice and
  12. can’t figure out how to do what I want.  (I have Dave Wilson’s book on order,
  13. but it hasn’t arrived yet.)
  14.     My application window contains a view which displays a plot of data
  15. generated by another program.  (The plot is a pair of continuous waveforms, and
  16. all that works just fine, so it has no bearing on my problem.)
  17.     But part of the functionality of my program is to give the user the ability
  18. to click on any part of the plot (such as the tip of the peak of a wave) and
  19. tell the program (by typing in a number) something about that data point (in
  20. this case, an equivalence of time to molecular size).  Right now I am using a
  21. modeless dialog to hold the TextEdit rect and a couple of buttons. It works,
  22. but is very clunky because of all the clicking back and forth between the
  23. document window and dialog (the click-and-type process is typically repeated
  24. about ten times).  I would like to be able to do away with the dialog window
  25. entirely and present the user with a flashing cursor right at the point where
  26. the mouse was clicked in the plot view.  Then the process would be: click, type
  27. 2 or 3 digits, and then enter (or return) to send the number off to storage,
  28. remove the TE, and return to a readiness for the next click.
  29.     I have tried to implement this with a TNumberText object as a subview of
  30. the plotting view, even though my window is not a ‘dialog’ (as MacApp
  31. understands it).  I am using a ViewEdit resource template, with the TNumberText
  32. placed initially in the middle of its superview and not shown.  I show it when
  33. the mouse is clicked in the plot view.  That part works, I think. At least, the
  34. TE rectangle appears when and where I expect it.  But there is something wrong
  35. with either my instantiation of the object or my handling of the target chain
  36. because my experimental mousedown in the TE invokes the debugger with a “nil
  37. handle” error message (my DoMouseCommand for the object simply beeps, so I can
  38. tell it took the click).
  39.     So finally my question, which really has several parts.  One, is what I am
  40. trying to do reasonable and possible?  Two, can I use TNumberText in this case,
  41. even though I am not working with a dialog view?  Three, is there some trick to
  42. instantiating a subview such as this, or does FindSubView do the job?  Four,
  43. how does one switch gTarget reliably, and in such a way that a TE would not
  44. only appear on screen, but flash its insertion point invitingly and immediately
  45. accept keyboard input?
  46.     And five (looking ahead and assuming this can all be made to work as I have
  47. tried to describe it), how does one handle the case of the user who clicks,
  48. gets the insertion point, then decides to click somewhere else in the plot
  49. view, which is no longer the target (or is this handled automatically by the
  50. click chain?)?
  51.  
  52. Here are a couple of my relevant code fragments which may help illuminate the
  53. problem.
  54.  
  55.    In MyDocument.DoMakeViews:
  56.  
  57.    aPlotView := TFPView(aView.FindSubView('plot'));
  58.    aPlotView.fMyDoc := SELF;   {the view now has a reference to its document}
  59.    SELF.fThisView := aPlotView; {the document now has a reference to this view}
  60. {now find the TNumberText subview}  {‘Mers’ refers to subcomponents of a
  61. nucleic acid}
  62.    aMersEntry := TFPMersEntry(aPlotView.FindSubView('tntx'));
  63.    aPlotView.fMersEntry := aMersEntry;
  64.  
  65.  
  66. And in my Plotting View’s DoMouseCommand:
  67.  
  68. {after some processing of the click position and displaying a number related to
  69. it...}
  70.  
  71.    fMersEntry.SetText('', TRUE);   {so the TE appears with no text showing}
  72.    AddSubView(fMersEntry); {one attempt to make sure of the end of the target
  73. chain}
  74.    fMersEntry.Show(TRUE, TRUE);  {show the text entry box}
  75.  
  76.    gApplication.SetTarget(fMersEntry); {make it the target}
  77.  
  78. Thanks in advance to anyone who has any helpful suggestions or solutions, or
  79. better yet has done something like this already.
  80.  
  81.